<template>
    <div class="roleHasUser">
        <div>
            <el-input placeholder="输入关键字搜索" v-model="userName" class="input-with-select" style="width: 200px">
                <el-button slot="append" icon="el-icon-search"></el-button>
            </el-input>
        </div>

        <table-index
            :dataSource="dataSource"
            height="400"
            :tableColumns="tableColumns"
            :btnList="btnList"
            :pageSize="pageSize"
            :pageCount="pageCount"
            :pageNo="pageNo"
            @pageChange="pageChange"
            selection
        ></table-index>
        <div style="text-align: right; margin-top: 20px">
            <el-button type="primary" @click="onSubmit">确定</el-button>
            <el-button @click="dialogTableClose">取消</el-button>
        </div>
    </div>
</template>

<script>
import tableIndex from '@/components/customComponents/customeTable/tableIndex'
// import {Utility} from "@/libs/utility"
import {userList} from '@/mockData/systemManage.js'
export default {
    props: ['roleId'],
    components: {
        tableIndex
    },
    data() {
        return {
            userName: '',
            // table 相关参数  begin
            dataSource: userList,
            tableColumns: [
                {
                    prop: 'name',
                    label: '姓名'
                },
                {
                    prop: 'loginName',
                    label: '登录名'
                },
                {
                    prop: 'sex',
                    label: '性别',
                    dictName: 'sex'
                },
                {
                    prop: 'tel',
                    label: '联系电话'
                },
                {
                    prop: 'email',
                    label: '邮箱'
                },
                {
                    prop: 'address',
                    label: '地址'
                },
                {
                    prop: 'isNormal',
                    label: '是否启用',
                    dictName: 'trueOrFalse'
                },
                {
                    prop: 'lastLoginTime',
                    label: '最后登录时间'
                },
                {
                    prop: 'lastLoginPerson',
                    label: '最后操作人'
                },
                {
                    prop: 'lastOprTime',
                    label: '最后操作时间'
                },
                {
                    prop: 'roleName',
                    label: '所属角色'
                }
            ],
            btnList: [],
            pageSize: 20,
            pageCount: 2,
            pageNo: 1
            // table 相关参数  end
        }
    },
    methods: {
        onSubmit() {
            this.dialogTableClose()
        },
        dialogTableClose() {
            this.$emit('close', '')
        },
        pageChange(p) {
            this.pageNo = p
            this.initPage()
        },
        initPage() {
            //   let self = this;
            //   AjaxCommon("/ccdc/cfg/device/device/listByPage", "post", {
            //     userName: this.userName,
            //     deviceStatus: this.status,
            //     deviceType: this.device_type,
            //     pageNo: this.pageNo,
            //     pageSize: this.pageSize,
            //   }).then((res) => {
            //     if (res.data.code == 200) {
            //       self.dataSource = res.data.result.records;
            //       self.pageCount = res.data.result.total;
            //     } else {
            //       PopupCommon.notify("error", res.data.message);
            //     }
            //   });
        }
    },
    mounted() {
        this.initPage()
    }
}
</script>

<style scoped lang="scss">
.roleHasUser {
    .mcTableIndex {
        height: 440px;
    }
}
</style>
